package com.example.arithmeticleetcode.learnArithmetic.priority.queue;

import com.example.arithmeticleetcode.learnArithmetic.priority.queue.heap.BinaryHeap;

import java.util.Comparator;

/**
 * @program: arithmetic-leetcode
 * @description:
 * @author: FangZhen
 * @create: 2020-11-03 11:48
 **/
public class PriorityQuque<E> {

    private BinaryHeap<E> heap = new BinaryHeap<>();

    public PriorityQuque(Comparator<E> comparator) {
        heap = new BinaryHeap<>(comparator);
    }

    public PriorityQuque() {
        this(null);
    }

    public void clear() {
        heap.clear();
    }

    public int size() {
        return heap.size();
    }

    public boolean isEmpRy() {
        return heap.isEmpty();
    }

    public void enQuque(E e) {
        heap.add(e);
    }

    public E deQuque() {
        return heap.remove();
    }

    public E front() {
        return heap.get();
    }
}
